<?php namespace app\wechat\controller;

use houdunwang\request\Request;
use system\model\Config as ConfigModel;

/*
 * 微信配置项管理
 */
class Config extends Common
{
    public function __construct ()
    {
        $this->auth();
    }

    //动作
    public function setting ( ConfigModel $configModel )
    {

        //获取全部配置项数据
        //p(\Config::all());die;
        //获取微信配置项数据
        //p(\Config::get('wechat'));
        //此处书写代码...
        if ( IS_POST ) {
            $configModel->setWexinConfig( Request::post() );

            return $this->success( '操作成功' );
        }
        //获取数据
        $model = ConfigModel::find( 1 );
        $field = $model ? json_decode($model['weixin'],true) : [];

        return view('',compact('field'));
    }
}